﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Student
{
    private static HashSet<int> numbers = new HashSet<int>();
    private string name;
    private int fakNum;

    public Student(string name, int fakNum)
    {
        if (numbers.Contains(fakNum))
        {
            throw new Exception("student with same fak number already exists");
        }
        if (fakNum < 10000 || fakNum > 99999)
        {
            throw new ArgumentOutOfRangeException("not a valid fak number");
        }
        if (name == "")
        {
            throw new ArgumentException("name must not be an empty string");
        }
        this.name = name;
        this.fakNum = fakNum;
        numbers.Add(fakNum);
    }

    public string Name
    {
        get
        {
            return name;
        }
    }

    public int FakNum
    {
        get
        {
            return fakNum;
        }
    }
}

class Course
{
    private Dictionary<int,Student> attendants;

    public Course()
    {
        attendants = new Dictionary<int, Student>();
    }

    public bool AddStudent(Student toAdd)
    {
        if (attendants.Count == 30)
        {
            throw new ArgumentException("Course is full");
        }
        if(attendants.ContainsKey(toAdd.FakNum))
        {
            throw new ArgumentException("same student is already attending the course");
        }
        attendants[toAdd.FakNum] = toAdd;
        return true;
    }

    public bool RemoveStudent(int toRemove)
    {

        if (attendants.ContainsKey(toRemove))
        {
            attendants.Remove(toRemove);
            return true;
        }
        return false;
    }
}

